// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from "vue";
import App from "./App";
import router from "./router";

import AsyncComputed from "vue-async-computed";
Vue.use(AsyncComputed);

import _font from "./utils/data/font";

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";

import "swiper/dist/css/swiper.css";
import VueAwesomeSwiper from "vue-awesome-swiper";
Vue.use(VueAwesomeSwiper);

import "jquery";

//加载vuex
import store from "./store";

//为了支持手机端
import MuseUI from "muse-ui";
import "muse-ui/dist/muse-ui.css";

console.log("xxxxxxxxxx22", _font());

//支持fabricjs
import { fabric } from "fabric";

// import "fabric-customise-controls";

//加载js
Vue.use(fabric);
Vue.use(MuseUI);
Vue.use(ElementUI);

//初始化参数 dpi什么
{
  //获取到屏幕放大比例。。。。注意不是dpi，dpi不变
  Vue.prototype.DPR = window.devicePixelRatio;

  let arrDPI = [];
  let tmpNode = document.createElement("DIV");
  tmpNode.style.cssText =
    "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
  document.body.appendChild(tmpNode);
  arrDPI[0] = parseInt(tmpNode.offsetWidth);
  arrDPI[1] = parseInt(tmpNode.offsetHeight);
  tmpNode.parentNode.removeChild(tmpNode);

  //应该考虑x和y轴的dpi是否一致，不一致应该提醒。。。错误
  if (arrDPI[0] != arrDPI[1]) {
    console.log("dpi不一致............");
    throw "dpi不一致";
  }

  //96dpi
  Vue.prototype.DPI = arrDPI[0];
  console.log(arrDPI);
}

Vue.config.productionTip = false;

/* eslint-disable no-new */
new Vue({
  el: "#app",
  router,
  store,
  components: { App },
  template: "<App/>",
});
